package com.hl.domain;

import com.fasterxml.jackson.annotation.JsonFormat;

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.concurrent.ThreadLocalRandom;

public class OrderUUID {
//    @JsonFormat(pattern = "yyyy-MM-dd")
    private  static  final SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmss");
    //定义随机数范围
    private static  final  int seq=100000;

    public static String getOrderUUID(String prex){
        //生成随机数
        int random = ThreadLocalRandom.current().nextInt(seq);
        //生成时间戳
        String time = sdf.format(new Date());
        //拼接
        return prex+time+String.format("%05d",random);
    }
}
